package org.cloud.web.controller;

import org.cloud.web.entity.RenderInstances;
import org.cloud.web.service.IRenderInstancesService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 渲染实例表 前端控制器
 * </p>
 *
 * @author LiHan
 * @since 2025-07-25
 */
@RestController
@RequestMapping("/renderInstances")
public class RenderInstancesController {

    private final IRenderInstancesService iRenderInstancesService;

    public RenderInstancesController(IRenderInstancesService iRenderInstancesService) {
        this.iRenderInstancesService = iRenderInstancesService;
    }

    /**
     * 添加渲染实例表
     * @param renderInstances 渲染实例
     */
    @RequestMapping("/addRenderInstances")
    public void addRenderInstances(RenderInstances renderInstances) {
        iRenderInstancesService.save(renderInstances);
    }

    /**
     * 修改渲染实例表
     * @param renderInstances 渲染实例
     */
    @RequestMapping("/addRenderInstances")
    public void updateRenderInstances(RenderInstances renderInstances) {
        iRenderInstancesService.updateById(renderInstances);
    }

    /**
     * 删除渲染实例表
     * @param renderInstances 渲染实例
     */
    @RequestMapping("/removeRenderInstances")
    public void removeRenderInstances(RenderInstances renderInstances) {
        iRenderInstancesService.removeById(renderInstances.getId());
    }

    /**
     * 查询渲染实例
     * @return 获取所有的渲染实例
     */
    @RequestMapping("/queryRenderInstances")
    public List<RenderInstances> queryRenderInstances() {
        return iRenderInstancesService.list();
    }
}
